use actix_web::{get, web, Responder};
use serde::Deserialize;
use actix_web::web::Query;

#[get("/test1/{id}/{name}/index.html")]
pub async fn test1(web::Path((id, name)): web::Path<(u32, String)>) -> impl Responder {
    return format!("Hello {}! id:{}", name, id);
}

#[derive(Deserialize)]
struct Info {
    aaa: Option<String>,
}

#[get("/test2")]
pub async fn test2(info: Query<Info>) -> impl Responder {
    // if info.aaa == Err {
    //     info.aaa = Option::from("".to_string());
    // }
    format!("{:?}", info.aaa)
    // format!("Welcome {}!", Ok(&info.aaa))
}
